package xp2p.job;

import xp2p.inter.client.FileService;
import xp2p.inter.client.InnerException;
import xp2p.inter.client.MessageClient;
import xp2p.inter.client.Statics;

public abstract class JobBase
{
	public abstract void main(String[] args) throws InnerException;

	protected final int getState()
	{
		return 0;
	}
	
	protected final int getCheckPoint()
	{
		return 0;
	}
	
	protected final void checkPoint()
	{		
		// TODOH checkpoint logic here
	}
	
	protected final boolean wasCheckpoint()
	{
		return false;
	}
	
	protected final void barrier()
	{		
	}
	
	protected final FileService FileSvc = null;

	protected final MessageClient MsgSvc = null;

	protected final int getSize()
	{
		return Statics.Size;
	}
	
	protected final int getRank()
	{
		return Statics.Rank;
	}	
	
	protected final void init()
	{
		preInit();
	}
	
	private final void preInit()
	{
		// TODOH initialize all needed services, restore last written state etc
	}
}
